package com.decent.ejfadmin.common.bean;

import com.decent.ejfadmin.utils.ToolsExecute;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 供货卡密
 *
 * @author 王元鑫
 * @date 2016/7/29
 */
@SuppressWarnings("ALL")
public class SupplyCard implements Serializable {
    /**
     * 失败订单销卡面值、预判面值
     */
    public static final BigDecimal FAIL_FACE = new BigDecimal(0);
    private static final long serialVersionUID = 2172370909967556212L;
    /**
     * 自增id
     */
    private Long id;
    /**
     * 对内订单号
     */
    private String orderId;
    /**
     * 会员id
     */
    private Long userId;
    /**
     * 批次号
     */
    private String batchId;
    /**
     * 卡号
     */
    private String cardNumber;
    /**
     * 运营商
     */
    private Integer productType;
    /**
     * 发行地区
     */
    private String area;
    /**
     * 卡面值
     */
    private BigDecimal face;
    /**
     * 供货价
     */
    private BigDecimal userPrice;
    /**
     * 结算面值
     */
    private BigDecimal settlePrice;
    /**
     * 订单状态
     */
    private Integer status;
    /**
     * 入库时间
     */
    private String startTime;
    /**
     * 处理时间
     */
    private String endTime;
    /**
     * 供货有效期
     */
    private String effectTime;
    /**
     * 入库时间（日期）
     */
    private Date startDate;
    /**
     * 是否补结算
     */
    private Integer added;
    /**
     * 停售原因
     */
    private String failReason;
    /**
     * 销卡地区:0全国,1省内
     */
    @JsonIgnore
    private Integer supplyArea;
    /**
     * 卡密
     */
    @JsonIgnore
    private String cardPwd;
    /**
     * 预判面值
     */
    @JsonIgnore
    private BigDecimal judgeFace;
    /**
     * 价格模板id
     */
    @JsonIgnore
    private Integer speed;
    /**
     * 手动补结算标记
     */
    @JsonIgnore
    private Integer transferMark;
    /**
     * 产品编号
     */
    @JsonIgnore
    private Integer productId;
    /**
     * 卡券图片key
     */
    @JsonIgnore
    private String aliKey;

    public SupplyCard() {
    }

    public SupplyCard(BigDecimal userPrice, BigDecimal face) {
        this.userPrice = userPrice;
        this.face = face;
    }

    public String getAliKey() {
        return aliKey;
    }

    public void setAliKey(String aliKey) {
        this.aliKey = aliKey;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getBatchId() {
        return batchId;
    }

    public void setBatchId(String batchId) {
        this.batchId = batchId;
    }

    public String getCardNumber() {
        return cardNumber;
    }

    public void setCardNumber(String cardNumber) {
        this.cardNumber = cardNumber;
    }

    public Integer getProductType() {
        return productType;
    }

    public void setProductType(Integer productType) {
        this.productType = productType;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public BigDecimal getFace() {
        return ToolsExecute.decimalKillZero(face);
    }

    public void setFace(BigDecimal face) {
        this.face = face;
    }

    public BigDecimal getUserPrice() {
        return ToolsExecute.decimalKillZero(userPrice);
    }

    public void setUserPrice(BigDecimal userPrice) {
        this.userPrice = userPrice;
    }

    public BigDecimal getSettlePrice() {
        return ToolsExecute.decimalKillZero(settlePrice);
    }

    public void setSettlePrice(BigDecimal settlePrice) {
        this.settlePrice = settlePrice;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public Integer getSpeed() {
        return speed;
    }

    public void setSpeed(Integer speed) {
        this.speed = speed;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public String getEffectTime() {
        return effectTime;
    }

    public void setEffectTime(String effectTime) {
        this.effectTime = effectTime;
    }

    public Date getStartDate() {
        return startDate == null ? null : (Date) startDate.clone();
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate == null ? null : (Date) startDate.clone();
    }

    public Integer getAdded() {
        return added;
    }

    public void setAdded(Integer added) {
        this.added = added;
    }

    public String getFailReason() {
        return failReason;
    }

    public void setFailReason(String failReason) {
        this.failReason = failReason;
    }

    public String getCardPwd() {
        return cardPwd;
    }

    public void setCardPwd(String cardPwd) {
        this.cardPwd = cardPwd;
    }

    public BigDecimal getJudgeFace() {
        return ToolsExecute.decimalKillZero(judgeFace);
    }

    public void setJudgeFace(BigDecimal judgeFace) {
        this.judgeFace = judgeFace;
    }

    public Integer getSupplyArea() {
        return supplyArea;
    }

    public void setSupplyArea(Integer supplyArea) {
        this.supplyArea = supplyArea;
    }

    public Integer getTransferMark() {
        return transferMark;
    }

    public void setTransferMark(Integer transferMark) {
        this.transferMark = transferMark;
    }

    public Integer getProductId() {
        return productId;
    }

    public void setProductId(Integer productId) {
        this.productId = productId;
    }

    @Override
    public String toString() {
        return "SupplyCard{" +
                "id=" + id +
                ", orderId='" + orderId + '\'' +
                ", userId=" + userId +
                ", batchId='" + batchId + '\'' +
                ", cardNumber='" + cardNumber + '\'' +
                ", productType=" + productType +
                ", area='" + area + '\'' +
                ", face=" + face +
                ", userPrice=" + userPrice +
                ", settlePrice=" + settlePrice +
                ", status=" + status +
                ", startTime=" + startTime +
                ", endTime=" + endTime +
                ", effectTime='" + effectTime + '\'' +
                ", startDate=" + startDate +
                ", added=" + added +
                ", failReason='" + failReason + '\'' +
                ", supplyArea=" + supplyArea +
                ", cardPwd='" + cardPwd + '\'' +
                ", judgeFace=" + judgeFace +
                ", transferMark=" + transferMark +
                ", productId=" + productId +
                ", aliKey='" + aliKey + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        SupplyCard card = (SupplyCard) o;

        if (!orderId.equals(card.orderId)) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        return orderId.hashCode();
    }
}
